/**
*@author Syrings
*@version 2012-04-01
*Modifications:Remove the get set method, the global variable become private
//********************************************
*/

package sayAct;

import java.util.Scanner;

import player.Player;
import player.PlayerIO;
import card.SayActCard;

public class sayActWindow {

	private Player selectedPlayer;
	private SayActCard selectedCard;
	
	/**
	Greet player that you just step on event cell
	*/
	public void greet(Player player){
		selectedPlayer =  player;
		
		System.out.println( "Hello " + selectedPlayer.getRole() +
				"\nYou just step in to Say and Act Cell!");
		
		System.out.println("Now press Enter to pick an question: ");
		Scanner keyboard = new Scanner(System.in);
		keyboard.nextLine();
		
		promptDrawQuestion();
		displayQuestion();
		askFinish();
		/**
		update player cell
		 */
		sayActEnd();
	}
	
	public void promptDrawQuestion(){
		sayActProcessor sayActProcess = new sayActProcessor();
		selectedCard = sayActProcess.getSayActCard();
		System.out.println("You just select SayAct Card " + selectedCard.getSayActID());
	}
	
	public void displayQuestion(){
		System.out.println("The id of the question is " + selectedCard.getSayActID());
		System.out.println("The question is: " + selectedCard.getQuestion());
	}
	
	public void askFinish() {
		System.out.println("Press Enter if you have complete your task.");
		Scanner keyboard = new Scanner(System.in);
		keyboard.nextLine();
	}
	
	private void sayActEnd(){
		sayActProcessor sayActProcess = new sayActProcessor();
		sayActProcess.updateScore(selectedPlayer, selectedCard);
		
		PlayerIO print = new PlayerIO();
		print.updateSEValue(selectedPlayer);
		System.out.println("Say and Act Stop here.");
		System.out.println("**************************************");
	}
	
}
